package com.test.client.customTimeLine;

import com.google.gwt.core.client.JavaScriptObject;

class EventSourceImpl {
	// -------------------------------------------------------------------
	// EventSource
	// -------------------------------------------------------------------

	public native static EventSource createEventSourceObject() /*-{
		var source = new $wnd.Timeline.DefaultEventSource();
		return source;
	}-*/;

	public native static void clear(EventSource source) /*-{
		source.clear();
	}-*/;

	public native static void loadXML(JavaScriptObject xml, String url,
			EventSource source) /*-{
		source.loadXML(xml, url);
	}-*/;

	public native static void loadXMLText(String xml, String url,
			EventSource source) /*-{
		var xmlDoc = $wnd.TimelineHelper.parseXML(xml);

		source.loadXML(xmlDoc, url);
	}-*/;

	public native static void loadXML(String dataUrl, EventSource eventSource) /*-{
		$wnd.Timeline.loadXML(dataUrl, function(xml, url) { eventSource.loadXML(xml, url); });
	}-*/;

	public native static void loadJSON(String jsonString, String url,
			EventSource eventSource)/*-{
				var jsonData = eval('(' + jsonString + ')');
				eventSource.loadJSON(jsonData, url);
			}-*/;

}
